﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JOIN.Rights.Model;
using JOIN.Rights.BLL;
using Kevin.Framework.Data;
using Kevin.Framework;

namespace JOIN.Rights.Web.Base
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
            43 9F E3 1E  是溶解氧的原始电压值  319.7744
41 05 49 AE   是溶解氧的温度值 8.330488
40 7C E3 50   是溶解氧值 3.951374
42 06 1F EF   是溶解氧的饱和度值 33.53119
            */
            string hex = "";
            List<string> list = new List<string>() { "441D286B", "41A4FC87", "41052102", "42B92DAC" };
            List<float> result = new List<float>();
            list.ForEach(o => result.Add(o.HexStr2Float()));

            string sql=@"select a.* from dbo.TU_User a,dbo.TU_Company b
                        where a.companyID=b.companyID and b.CompanyID=:test";
            DBSqlHelper.ExecuteDataTable(sql,"3215400049");

        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string userNo = txtUserID.Text.Trim();
            string userPwd = txtPwd.Text.Trim();

            AdminBLL bll = new AdminBLL(new AdminInfo() { UserNO = userNo, UserPwd = userPwd.ToMD5String() });
            ServiceResult<AdminInfo> result = bll.Check();
            if (result.Successed)
            {
                Session["Admin"] = result.Object;
                Response.Redirect("MainForm.aspx");
            }
        }
    }
}